package com.freak.kotlinfitnessserver.room.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.freak.kotlinfitnessserver.room.FeaturesData
import kotlinx.coroutines.flow.Flow

@Dao
interface FeaturesDataDao {
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    suspend fun insert(featuresData: FeaturesData): Long

    @Update
    suspend fun update(featuresData: FeaturesData): Int

    @Delete
    suspend fun delete(featuresData: FeaturesData): Int

    @Query("SELECT * from features")
    fun getFeaturesDataList(): Flow<List<FeaturesData>>

    @Query("SELECT * from features WHERE deviceType = :deviceType")
    suspend fun getFeaturesData(deviceType: String): FeaturesData
}